#! /usr/bin/env python

import rospy
from my_pkg.msg import my_msg

def callback(data):
    rospy.loginfo("I heard: " + str(data.s) + " and " + str(data.data))


def listener():
    rospy.init_node('listener', anonymous=True)
    rospy.Subscriber('chatter', my_msg, callback)
    rospy.spin()

if __name__ == "__main__":
    try:
        listener()
    except rospy.ROSInitException:
        pass